<template>
	<div class="areaCode_com">
		<van-action-sheet v-model="hasShow" :title="$t('home.chooseTokens')">
			<div class="content">
				<div class="list_box">
					<div class="item_box" v-for="(item,index) in currencyList" :key="index" @click="handleItem(item)">
						<img :src="item.icon_img" class="img" />
						{{item.name}}
					</div>
				</div>
			</div>
		</van-action-sheet>
	</div>
</template>

<script>
	export default {
		props: {
			value: {
				type: Boolean,
				default: false,
			},
			list: {
				type: Array,
				default: function() {
					return []
				}
			}
		},
		components: {},
		data() {
			return {

			}
		},
		computed: {
			hasShow: {
				get() {
					return this.value
				},
				set(val) {
					this.$emit('input', val)
				}
			},
			currencyList() {
				let arr = this.$store.state.currencyList
				// console.log('this', this.list);
				if (this.list && this.list.length > 0) {
					arr = this.list
				}
				return arr
			}
		},
		watch: {},
		mounted() {},
		methods: {
			handleItem(i) {
				this.$emit('change', i)
				this.$emit('input', false)
			}
		}
	}
</script>
<style lang="less" scoped>
	.areaCode_com {
		::v-deep .van-popup {
			background-color: #1A1A1A;

			.van-action-sheet__header {
				text-align: left;
				color: #fff;
				padding-left: 16px;
			}

			.van-action-sheet__close {
				color: #fff;
			}
		}

		.content {
			color: #fff;
			padding: 0 15px;
			text-align: left;

			.list_box {
				overflow-y: auto;
				max-height: calc(80vh - 70px);

				.item_box {
					text-align: left;
					display: flex;
					align-items: center;
					margin-bottom: 30px;

					.img {
						width: 38px;
						height: 38px;
						margin-right: 15px;
					}
				}
			}
		}
	}
</style>